{extend name="index_base" /} {block name="seo"}
<title>用户登录 - {$site_config['site_title']} - {$site_config['seo_title']}</title>


<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}"> {/block} {block name="body"}
<div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">登录</li>

            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form method="post">
                            <div class="layui-form-item">
                                <label for="L_username" class="layui-form-label">帐号</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_username" name="username" required lay-verify="required" placeholder="手机号/邮箱/昵称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass" name="pass" required lay-verify="required|pass" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">

                                <!-- <div class="layui-input-inline">
                  <input id="un-login" type="checkbox" name="un-login" title="十天内免登录" lay-skin="primary">
                  
                </div> -->
                                <div class="layui-form-mid layui-word-aux"><a href="{:url('user/login/forget')}">忘记密码？</a></div>
                            </div>
                            {if condition="$loginyzm eq 1"}
                            <div class="layui-form-item">
                                <label for="L_vercode" class="layui-form-label">验证码</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_vercode" name="code" required lay-verify="required" placeholder="请填写验证码" autocomplete="off" class="layui-input">
                                </div>
                                <div class="" style="float: left;">
                                    <img src="{:url('user/index/captcha')}" onclick="this.src='{:url('user/index/captcha')}?'+Math.random();" style="float:left; cursor:pointer;" id="captcha" alt="captcha" />
                                </div>
                            </div>
                            {/if}
                            <div class="layui-form-item">
                                <button class="layui-btn" lay-filter="login_index" lay-submit>立即登录</button>
                                <a href="{:url('user/login/reg')}" class="layui-btn layui-btn-primary" lay-filter="login_index">注册账号</a>
                            </div>
                            {if condition="$qq_login eq 1"}
                            <div class="layui-form-item fly-form-app">
                                <span>或者使用社交账号登录</span>
                                <a href="{:url('user/applogin/qqlogin')}" onclick="layer.msg('正在通过QQ登录', {icon:16, shade: 0.1, time:0})"  title="QQ登录" ><i class="layui-icon layui-icon-login-qq" style="font-size: 20px; color: #1E9FFF;"></i></a>
                            </div>
                            {/if}
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block} {block name="script"}
<script>
    layui.use('form', function() {
        var form = layui.form,
            jq = layui.jquery;

        form.verify({
            emailss: function(value) {
                if (value.length > 32) {
                    return '邮箱必须小于32位';
                }
            },
            pass: [/(.+){6,12}$/, '密码必须6到12位'],
            content: function(value) {
                layedit.sync(editIndex);
            }
        });

        form.on('submit(login_index)', function(data) {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            var param = data.field;
            jq.post('{:url("user/login/index")}', param, function(data) {
                if (data.code == 200) {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    }, function() {
                        location.href = '{:isset($_SERVER["HTTP_REFERER"])?((strpos($_SERVER["HTTP_REFERER"],"login")!== false||strpos($_SERVER["HTTP_REFERER"],"reg")!== false)?url("index/index/index"):$_SERVER["HTTP_REFERER"]):url("index/index/index")}';
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 2,
                        anim: 6,
                        time: 1000
                    });
                    jq('#captcha').attr('src', "{:url('index/captcha')}?" + Math.random());
                }
            });
            return false;
        });

    })
</script>{/block}